import os
name1 = str(input('请输入目录'))
list1 = list(os.walk(name1))
list2 = []
lentgh1 =len(list1)
for i in range(lentgh1):
    lentgh2 = len(list1[i])
    for j in range(1,lentgh2):
        for k in list1[i][j]:
            (x,y)=os.path.splitext(k)
            if y == '.mp4' or y == '.avi':
                name =name1 +'\ '+k+'\n'
                list2.append(name)
                
f1 = open('mp4.txt','w')
f1.writelines(list2)
f1.close()
